<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>测试请求记录</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/toastr/toastr.min.css}">
    <link rel="stylesheet" th:href="@{/css/app.css}">

    <script type="text/javascript" th:src="@{/js/jquery-2.1.4.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/bootstrap.min.js}"></script>
    <script type="text/javascript" th:src="@{/toastr/toastr.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/jsencrypt.min.js}"></script>
</head>
<body>

<div class="container-fluid table-responsive" style="border: 0; width: 100%;">


    <button id="btnTest" class="btn btn-primary" type="button">测试请求</button>



    <div style="text-align: left;">

        <div style="margin: 10px 0; font-weight: bold;">请求结果是:</div>
        <div id="searchResult" style="padding: 10px;"></div>
    </div>

</div>
<script th:inline="javascript">
    /*<![CDATA[*/
        toastr.options = {
            "positionClass": "toast-center-center"
        };

        var errorMsg = [[${errorMsg}]];
        if(errorMsg) {
            toastr.warning(errorMsg);
        }


        $('#btnTest').click(function (e) {
            var performId = 'RQ' + new Date().getTime();
            var requestDate = new Date().getTime();
            var requestType = "least_conn"


            $.ajax({
                type:'post',
                url:[[@{/web/request}]],
                data: { performId: performId, requestDate: requestDate, requestType: requestType },
                success:function(res){
                    if(res){
                        console.log(res);
                        var htmlStr = res.message;
                        $('#searchResult').html(htmlStr);

                    }else{
                        toastr.warning("检索内容失败", "温馨提示");
                    }
                }
            });

        });

    /*]]>*/
</script>
</body>
</html>